<template>
	<view class="main1">
		<view class="table">
			<view class="table_top">
				<view class="th">用户ID</view>
				<view class="th">书籍名称</view>
				<view class="th">收入详情</view>
			</view>
			<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scrolltoupper="upper"
				@scrolltolower="lower" @scroll="scroll">
				<view class="scroll-view-item" v-for="(v,k) in HistoryearningsList" :key="k">
					<view class="td">
						{{v.order_user_id}}
					</view>
					<view class="td">
						{{v.book_title}}
					</view>
					<view class="td">
						{{v.money}}元
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "Historyearnings",
		props: {
			HistoryearningsList: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				scrollTop: 0,
				oldscrollTop: '',
			};
		},
		watch: {
			'Teamearningslist': {
				handler: function(newValue, oldValue) {
					if (newValue.length <= 15) {
						this.goTop()
					}
				},
				deep: true
			}
		},
		methods: {
			upper(e) {},
			lower(e) {
				this.$emit('aaa', 2)
			},
			scroll(e) {
				this.oldscrollTop = e.detail.scrollTop
			},
			goTop(e) {
				// 解决view层不同步的问题
				this.scrollTop = this.oldscrollTop
				this.$nextTick(function() {
					this.scrollTop = 0
				});
			},
		},
	}
</script>

<style lang="less" scoped>
	@import url("Earnings.less");
</style>